package com.xncoding.socket.socket.client.javaWebsocket;

import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;

import java.net.URI;

public class myWebSocketClient extends WebSocketClient {
    public myWebSocketClient(URI serverUri) {
        super(serverUri);
    }

    @Override
    public void onOpen(ServerHandshake serverHandshake) {
        System.out.println("websocket成功连接");
    }

    @Override
    public void onMessage(String s) {
        System.out.println("收到服务端发送的消息："+s);

    }

    @Override
    public void onClose(int i, String s, boolean b) {
        System.out.println("已经和服务端断开连接");
    }

    @Override
    public void onError(Exception e) {
        System.out.println("和服务端通信发送异常");
    }
}

